package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        PrintWriter pw  = new PrintWriter(
                new BufferedWriter(
                new OutputStreamWriter(
                new FileOutputStream("pw.txt"), StandardCharsets.UTF_8)),true);
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入内容,输入exit退出");
        while (true){
            if ("exit".equals(scan.next())){
                break;
            }
            pw.println(scan.next());
        }
        pw.close();
    }
}
